package com.steven.love.controller;

import com.alibaba.fastjson.JSONObject;
import com.steven.love.pojo.Diary;
import com.steven.love.service.DiaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DiaryController {

    @Autowired
    private DiaryService service;

    @PostMapping("/love/query")
    public JSONObject queryAllLoveInfo(Long page){
        return service.queryAllLoveInfo(page);
    }

    @PostMapping("/love/add")
    public JSONObject addLoveDiary(Diary diary){
        return service.addLoveDiary(diary);
    }

    @PostMapping("/love/delete")
    public JSONObject deleteLoveDiary(Long id){
        return service.deleteLoveDiary(id);
    }

    @PostMapping("/unhappy/query")
    public JSONObject queryAllUnHappyInfo(Long page){
        return service.queryAllUnHappyInfo(page);
    }

    @PostMapping("/unhappy/add")
    public JSONObject addUnHappyDiary(Diary diary){
        return service.addUnHappyDiary(diary);
    }

    @PostMapping("/unhappy/delete")
    public JSONObject deleteUnHappyDiary(Long id){
        return service.deleteUnHappyDiary(id);
    }
}
